// ShutdownHandler monitors a shutdown event.

#ifndef LONGKEY_COMMON_SHUTDOWN_HANDLER_H_
#define LONGKEY_COMMON_SHUTDOWN_HANDLER_H_

#include "event_handler.h"
#include "basictypes.h"
#include "scoped_any.h"

class Reactor;
class ShutdownCallback;

class ShutdownHandler : public EventHandler
{
public:
	ShutdownHandler();
	~ShutdownHandler();

	HRESULT Initialize(Reactor* reactor,
		ShutdownCallback* shutdown,
		bool is_machine);

	virtual void HandleEvent(HANDLE handle);

private:
	Reactor* reactor_;
	scoped_event shutdown_event_;
	ShutdownCallback* shutdown_callback_;
	bool is_machine_;
	DISALLOW_EVIL_CONSTRUCTORS(ShutdownHandler);
};

#endif	// LONGKEY_COMMON_SHUTDOWN_HANDLER_H_